
const fs = require('fs-extra');

(function main() {
    // test3();
    // test2();
    // test1();
})();

function test4() {
}

function test3() {
    // const dir = 'F:\\test2\\this\\path\\does\\not\\exist'
    const dir = 'F:\\test2\\this'
    // With async/await:
    async function example(_dir) {
        try {
            await fs.remove(_dir)
            console.log('success!')
        } catch (err) {
            console.error(err)
        }
    }

    example(dir)
}

function test2() {
    // const dir = '/tmp/this/path/does/not/exist'
    const dir = 'F:\\test2\\this\\path\\does\\not\\exist'
    const options = {
        mode: 0o2775
    }
    // With async/await and an options object, containing mode:
    async function exampleMode(directory) {
        try {
            await fs.mkdirs(directory, options)
            console.log('success!')
        } catch (err) {
            console.error(err)
        }
    }
    exampleMode(dir)
}


function test1() {
    async function copyFiles() {
        try {
            // await fs.copy('/tmp/myfile', '/tmp/mynewfile')
            await fs.copy('F:\\test2\\111.txt', 'F:\\test2\\222.txt')
            console.log('success!')
        } catch (err) {
            console.error(err)
        }
    }

    copyFiles()
}



